<h1><%= t "user.account.index" %></h1>
<div style="height: 200px;">
  <div style="float: left; margin-right: 50px;">
    <h3><%= t "user.address" %></h3>
    <%= @user.title %>
    <br/>
    <%= "#{@user.firstname} #{@user.lastname}" %>
    <br/>
    <%= @user.street %>
    <br/>
    <%= "#{@user.zip} #{@user.city}" %>
  </div>

  <div>
    <h3><%= t "user.email" %>:</h3>
    <%= @user.email %>
  </div>
</div>

<div>
  <%= link_to t("user.account.edit"), edit_user_path(@user), :class => "button" %>
</div>

<div style="margin-top: 50px;">
  <h3><%= t "order.s" %></h3>
  <% if @orders.empty? %>
      <%= t "order.none" %>
  <% else %>
      <table>
        <tr>
          <th><%= t "date.index" %></th>
          <th><%= t "number.general.amount" %></th>
          <th><%= t "order.status" %></th>
          <th>PDF</th>
        </tr>
        <% @orders.each do |order| %>
            <tr>
              <td><%= link_to l(order.updated_at.to_s[0..9].to_date), "#", :class=>"profile_order_link" %> </td>
              <td><%= number_to_currency order.total %></td>
              <td><%= order_status_to_text(order.order_placed, order.shipped) %></td>
              <td><%= link_to pdf_icon, carts_bestellung_path(:format => "pdf", :cart_id => order.id) %></td>
            </tr>
            <tr style="display: none;">
              <td colspan="4">
                <table class="inner_table">
                  <thead>
                  <tr>
                    <th><%= t "product.model_name" %></th>
                    <th><%= t "product.price" %></th>
                    <th><%= t "product.amount" %></th>
                    <th><%= t "product.total" %></th>
                  </tr>
                  </thead>
                  <tbody>
                  <% order.cart_items.each do |item| %>
                      <tr>
                        <td><%= item.product.name %></td>
                        <td><%= number_to_currency item.price %></td>
                        <td><%= item.amount %></td>
                        <td><%= number_to_currency(item.price * item.amount) %></td>
                      </tr>
                  <% end %>
                  </tbody>
                </table>
              </td>
            </tr>
        <% end %>
      </table>
  <% end %>
</div>
